package chixing.day11.work.w9;
public class Financial implements Approver {
    private String name;

    public Financial(String name) {
        this.name = name;
    }

    @Override
    public void approve(ApprovalRequest request) {
        // 财务主要处理费用报销申请
        if (request instanceof ExpenseRequest) {
            ExpenseRequest expenseRequest = (ExpenseRequest) request;
            System.out.println("申请人: " + request.getApplicant());
            System.out.println("申请时间: " + request.getRequestTime());
            System.out.println("申请说明: " + request.getDescription());
            System.out.println("报销金额: " + expenseRequest.getAmount() + "元");

            if (expenseRequest.getAmount() <= 5000) {
                System.out.println("财务 " + name + " 批准了费用报销申请");
            } else {
                System.out.println("报销金额超过5000元，需总经理审批");
            }
        } else {
            System.out.println("财务 " + name + " 不处理" + request.getRequestType());
        }
        System.out.println("------------------------");
    }
}

